package soul;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import soul.filter.LoggerFilter;

/**
 * Created by sunzhengjie on 2016/11/17.
 */
@SpringBootApplication
@EnableAutoConfiguration
@EnableTransactionManagement
@MapperScan(basePackages = "soul.mapper")
public class Application {
    @Autowired
    private LoggerFilter loggerFilter;

    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(loggerFilter);
        registrationBean.setOrder(1);
        return registrationBean;
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
        System.out.println("--启动了--");
    }
}
